package Engine.error
{
	import flash.utils.*;
	
	public class RMIErrorCode extends Object
	{
		private static var _map:Dictionary = new Dictionary();
		public static const ExceptionCodeRMI:int = 20000;
		public static const ExceptionCodeNotSupported:int = 20001;
		public static const ExceptionCodeInvoke:int = 20002;
		public static const ExceptionCodeTimeOut:int = 20003;
		public static const ExceptionCodeConnectionNotConnect:int = 20004;
		public static const ExceptionCodeConnectionClosed:int = 20005;
		public static const ExceptionCodeConnectionWrite:int = 20006;
		public static const ExceptionCodeObjectNotExist:int = 20007;
		public static const ExceptionCodeOperationNotExist:int = 20008;
		public static const ExceptionCodeNotInstantiation:int = 20009;
		public static const ErrorDb_PlayerIdError:int = 32000;
		public static const ErrorDb_PlayerCreateUserNameExsit:int = 32001;
		public static const ErrorDb_PlayerCreateRoleNameExsit:int = 32002;
		public static const ErrorLogin_NeedLoginFromPlatform:int = 33000;
		public static const ErrorLogin_NoRole:int = 33001;
		public static const ErrorLogin_RoleNameIsToLong:int = 33002;
		public static const ErrorLogin_CreateRoleNameError:int = 33003;
		public static const ErrorLogin_CreateRoleDataError:int = 33004;
		public static const ErrorLogin_UserNameError:int = 33005;
		public static const ErrorGate_LoginNotLogin:int = 35003;
		public static const ErrorGate_LoginIsLogin:int = 35004;
		public static const ErrorGate_OperNotCD:int = 35005;
		
		public function RMIErrorCode()
		{
			this.init();
		}
		
		private function init() : void
		{
			_map[ExceptionCodeRMI] = "RMI基础错误";
			_map[ExceptionCodeNotSupported] = "RMI框架不支持此操作";
			_map[ExceptionCodeInvoke] = "RMI框架不支持这种调用";
			_map[ExceptionCodeTimeOut] = "网络连接超时";
			_map[ExceptionCodeConnectionNotConnect] = "服务器连接失败";
			_map[ExceptionCodeConnectionClosed] = "服务器连接断开";
			_map[ExceptionCodeConnectionWrite] = "网络数据IO错误";
			_map[ExceptionCodeObjectNotExist] = "服务对象不存在";
			_map[ExceptionCodeOperationNotExist] = "服务方法不存在";
			_map[ExceptionCodeNotInstantiation] = "服务没有实例化";
			_map[ExceptionCodeRMI] = "RMI基础错误";
			_map[ExceptionCodeNotSupported] = "RMI框架不支持此操作";
			_map[ExceptionCodeInvoke] = "RMI框架不支持这种调用";
			_map[ExceptionCodeTimeOut] = "网络连接超时";
			_map[ExceptionCodeConnectionNotConnect] = "服务器连接失败";
			_map[ExceptionCodeConnectionClosed] = "服务器连接断开";
			_map[ExceptionCodeConnectionWrite] = "网络数据IO错误";
			_map[ExceptionCodeObjectNotExist] = "服务对象不存在";
			_map[ExceptionCodeOperationNotExist] = "服务方法不存在";
			_map[ExceptionCodeNotInstantiation] = "服务没有实例化";
			_map[ErrorDb_PlayerIdError] = "玩家ID错误";
			_map[ErrorDb_PlayerCreateUserNameExsit] = "账号已存在";
			_map[ErrorDb_PlayerCreateRoleNameExsit] = "角色名已经存在";
			_map[ErrorLogin_NeedLoginFromPlatform] = "请先登录平台";
			_map[ErrorLogin_NoRole] = "账号没有角色";
			_map[ErrorLogin_RoleNameIsToLong] = "角色名太长";
			_map[ErrorLogin_CreateRoleNameError] = "角色名错误";
			_map[ErrorLogin_CreateRoleDataError] = "创建角色数据不正确";
			_map[ErrorLogin_UserNameError] = "错误的账号";
			_map[ErrorGate_LoginNotLogin] = "您还没有登陆，请刷新重试";
			_map[ErrorGate_LoginIsLogin] = "已经登陆服务器";
			_map[ErrorGate_OperNotCD] = "您的操作太快了";
		}
		
		public static function isInError(code:int) : Boolean
		{
			return code in _map;
		}
		
		public static function getErrorByCode(code:int) : String
		{
			return _map[code];
		}
	}
}
